<p class="Paragraph">Errornumber: Integer expression that specifies the number of the error to be simulated.</p>
<p class="Paragraph">The Error statement simulates the occurrence of an error during program execution. An error intercepted by an error-handling routine will not be reported, regardless of whether correcitve action was taken or not. The <span class="T1">Error statement</span> is used report an error when no error-handling routine is enabled, and stop program execution.</p>
<p class="Paragraph">Example:</p>
<p class="PropText">sub ExampleError</p>
<p class="PropText">on error goto ErrorHandler REM Set up error handler</p>
<p class="PropText">Dim iVar as Integer</p>
<p class="PropText">Dim sVar As String</p>
<p class="PropText">REM An error occurs due to non-existent file</p>
<p class="PropText">iVar = Freefile</p>
<p class="PropText">Open "\file9879.txt" for Input as #iVar</p>